home *** CD-ROM | disk | FTP | other *** search
- Path: erich.triumf.ca!bennett
- From: bennett@erich.triumf.ca (P.Bennett)
- Newsgroups: comp.lang.c
- Subject: Re: directories listing
- Date: 15 Jan 1996 07:58 PST
- Organization: TRIUMF: Tri-University Meson Facility
- Distribution: world
- Message-ID: <15JAN199607581827@erich.triumf.ca>
- References: <4dckfq$4um@news.ust.hk>
- NNTP-Posting-Host: ftp.triumf.ca
- News-Software: VAX/VMS VNEWS 1.50
-
- In article <4dckfq$4um@news.ust.hk>, cs_lcm@ug.cs.ust.hk (Lee Chun Man Raymond) writes...
- >
- >Hi,
- >
- > I wrote a C program that needs to print out a listing of
- >sub-directories of current working directory.
- >
- >The following is part of my program : ( Turbo C++ )
- >
- >struct find_t current_file;
- >int done;
- >..........
- >printf("Directories listing : \n");
- >done = _dos_findfirst(full_path , FA_DIREC, ¤t_file);
- >while (!done) {
- > strcpy(file_path, path_name);
- > strcat(file_path, "\\");
- > strcat(file_path, current_file.name)
- > printf("--> %s\n",file_path);
- > done = _dos_findnext(¤t_file);
- >}
- >
- >I don't know why it lists out all file including the sub-directories, but
- >I only want to lists our those sub-directories.
-
- The DOS service called by _dos_findfirst (and findnext) returns all _normal_
- files, _plus_ any having the attributes you specify. To list the directories
- only, you have to test the attributes of each returned file, and ignore any
- that are not what you want.
-
- Peter Bennett VE7CEI | Vessels shall be deemed to be in sight
- Internet: bennett@triumf.ca | of one another only when one can be
- Packet: ve7cei@ve7kit.#vanc.bc.ca | observed visually from the other
- TRIUMF, Vancouver, B.C., Canada | ColRegs 3(k)
- GPS and NMEA info and programs: ftp://sundae.triumf.ca/pub/peter/index.html
-
-
-
-
-
-
-
-
-
-
-
-